using Assets.Scripts.GDK;
using System.Collections;
using UnityEngine;
using UnityEngine.UI;

namespace Brick
{
	public class AdJsonBox : gdk_base_UI
	{
		public Image img;

		public Image icon;

		public Text tittle;

		public Text des;

		public void OnShowInfo(string ti, string de, string imgpath, string iconpath)
		{
			tittle.text = ti;
			des.text = de;
			StartCoroutine(IReStart(imgpath, img));
			StartCoroutine(IReStart(iconpath, icon));
		}

		private IEnumerator IReStart(string iconUrl, Image sp)
		{
			WWW www = new WWW(iconUrl);
			yield return www;
			if (www != null && string.IsNullOrEmpty(www.error))
			{
				Texture2D texture = www.texture;
				Sprite sprite2 = sp.sprite = Sprite.Create(texture, new Rect(0f, 0f, texture.width, texture.height), new Vector2(0.5f, 0.5f));
				sp.gameObject.SetActive(value: true);
			}
			else
			{
				sp.gameObject.SetActive(value: false);
			}
		}
	}
}

